<!DOCTYPE HTML>
<html lang="en">
<head>
<title>FileRecycle - Syntax &amp; Usage | AutoHotkey</title>
<meta name="description" content="The FileRecycle command sends a file or directory to the recycle bin if possible, or permanently deletes it." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>FileRecycle</h1>

<p>Sends a file or directory to the recycle bin if possible, or permanently deletes it.</p>

<pre class="Syntax"><span class="func">FileRecycle</span>, FilePattern</pre>
<h2>Parameters</h2>
<dl>

  <dt>FilePattern</dt>
  <dd><p>The name of a single file or a wildcard pattern such as C:\Temp\*.tmp. <em>FilePattern</em> is assumed to be in <a href="../Variables.htm#WorkingDir">%A_WorkingDir%</a> if an absolute path isn't specified.</p>
      <p>To recycle an entire directory, provide its name without a trailing backslash.</p></dd>

</dl>

<h2>Error Handling</h2>
<p><span class="ver">[v1.1.04+]</span>: This command is able to throw an exception on failure. For more information, see <a href="Catch.htm#RuntimeErrors">Runtime Errors</a>.</p>
<p><a href="../misc/ErrorLevel.htm">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<h2>Remarks</h2>
<p><a href="http://msdn.microsoft.com/en-us/library/bb762164.aspx">SHFileOperation</a> is used to do the actual work. This function may permanently delete the file if it is too large to be recycled; as of <span class="ver">[v1.0.96]</span>, a warning should be shown before this occurs.</p>
<p>The file may be permanently deleted without warning if the file cannot be recycled for other reasons, such as:</p>
<ul>
  <li>The file is on a removable drive.</li>
  <li>The Recycle Bin has been disabled, such as via the <code>NukeOnDelete</code> registry value.</li>
</ul>
<h2>Related</h2>
<p><a href="FileRecycleEmpty.htm">FileRecycleEmpty</a>, <a href="FileDelete.htm">FileDelete</a>, <a href="FileCopy.htm">FileCopy</a>, <a href="FileMove.htm">FileMove</a></p>
<h2>Examples</h2>
<div class="ex" id="ExBasic">
<p><a href="#ExBasic">#1</a></p>
<pre>FileRecycle, C:\temp files\*.tmp</pre>
</div>

</body>
</html>
